<%@page contentType="text/html; charset=utf-8"%>
<%@ include file="../inc/TagLibs.jsp"%>
<c:set var="pageTitle" value="帐务明细" />
<%@ include file="../inc/Title.jsp"%>
<head>
<script src="/js/popup_ext.js"></script>
<script language="javascript">
	function doCancel(){
		window.close();
	}
	function refreshWin(){
		if(popRetVal!=null){
			window.location.reload(true);
		}
	}
	function doBusinessBillShow(id){
		var url="/business/BusinessBillEdit.ihtm?id="+id;
		ShowIframe("业务单",url,1024,600,"refreshWin()",900,600);
	}
	function doAdjustBillShow(id){
		var url="/finance/AdjustBillEdit.ihtm?id="+id;
		ShowIframe("调账单",url,1024,500,"refreshWin()",900,600);
	}
	function doReceiveBillShow(id){
		var url="/finance/ReceiveBillEdit.ihtm?id="+id;
		ShowIframe("收款单",url,1024,500,"refreshWin()",900,600);
	}
	function doReceiveBillPrint(id){
		ShowConfirm('确认框','是否同时打印收款明细？',340,80,"showReceivePrintCallBack("+id+")");
	}
	function showReceivePrintCallBack(id){
		var printDetail="N";
		if(popRetVal!=null){
			printDetail="Y";
		}
		showWin(900,600,"/finance/ReceiveBillPrint.ihtm?id="+id+"&print_detail="+printDetail);
	}
	function doAdjustBillPrint(id){
		showWin(900,600,"/finance/AdjustBillPrint.ihtm?id="+id);
	}
	function doBusinessBillPrint(id){
		showWin(900,600,"/business/BusinessBillPrint.ihtm?id="+id);
	}
</script>
</head>
<body oncontextmenu="return false" class="sheet" style="text-align:center;">
<div class="sheet-main" style="width:860px;text-align:left;margin:auto;">
  <div class="sheet-top">
    <div class="content">
      <h2>帐务明细</h2>
      <p>${est.estName}</p>
    </div>
  </div>
  <div class="sheet-list">
    <div class="search-business">
				<%@include file="../inc/AlertMsg.jsp"%>
				<c:if test="${fn:length(businessBillList)==0 && fn:length(receiveBillList)==0 && fn:length(adjustBillList)==0}">
						没有帐务明细纪录
				</c:if>
				<c:if test="${fn:length(businessBillList)>0}">
		    <div class="table-list">
						<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center" id="itemTbl" >
							<tr>
								<th colspan="5" ><div align="left">业务单及预付款</div></th>
							</tr>
							<tbody id="itemRowTbl">
							<tr>
								<th width="20%" >业务单号</th>
								<th width="20%" >日期</th>
								<th width="20%" >总金额（元）</th>
								<th width="30%" >预付金额（元）</th>
								<th width="10%" >操作</th>
							</tr>
							<c:forEach var="item" items="${businessBillList}">
							<tr>
								<td >${item.billCode}</td>
								<td ><fmt:formatDate value="${item.orderDate}" pattern="yyyy-MM-dd"/></td>
								<td >${item.cost}</td>
								<td >${item.imprest}</td>
								<td >
									<a href="javascript:doBusinessBillShow('${item.id}');">查看</a>
									<a href="javascript:doBusinessBillPrint('${item.id}');">打印</a>
								</td>
							</tr>
							</c:forEach>
							</tbody>
						</table>
					</div>
				</c:if>
				<div class="blank12"></div>				
				<c:if test="${fn:length(receiveBillList)>0}">
		    <div class="table-list">
						<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center" id="itemTbl" >
							<tr>
								<th colspan="4"><div align="left">收款</div></th>
							</tr>
							<tbody id="itemRowTbl">
							<tr>
								<th width="20%" >收款单号</th>
								<th width="20%" >收款日期</th>
								<th width="50%" >收款金额（元）</th>
								<th width="10%" >操作</td>
							</tr>
							<c:forEach var="item" items="${receiveBillList}">
							<tr>
								<td >${item.billCode}</td>
								<td ><fmt:formatDate value="${item.receiveDate}" pattern="yyyy-MM-dd"/></td>
								<td >${item.cost}</td>
								<td >
									<a href="javascript:doReceiveBillShow('${item.id}');">查看</a>
									<a href="javascript:doReceiveBillPrint('${item.id}');">打印</a>
								</td>
							</tr>
							</c:forEach>
							</tbody>
						</table>
					</div>
				</c:if>
					<div class="blank12"></div>	
				<c:if test="${fn:length(adjustBillList)>0}">
		    <div class="table-list">
						<table width="98%" border="0" cellspacing="1" cellpadding="1" align="center" id="itemTbl" >
							<tr>
								<th colspan="5"><div align="left">调账</div></th>
							</tr>
							<tbody id="itemRowTbl">
							<tr>
								<th width="20%" >调账单号</th>
								<th width="20%" >调账日期</th>
								<th width="20%" >调账金额（元）</th>
								<th width="30%" >调账类型</th>
								<th width="10%" >操作</th>
							</tr>
							<c:forEach var="item" items="${adjustBillList}">
							<tr>
								<td >${item.billCode}</td>
								<td ><fmt:formatDate value="${item.adjustDate}" pattern="yyyy-MM-dd"/></td>
								<td >
									<c:if test="${item.adjustType=='COLLECT_ABATE' || item.adjustType=='BUS_BACK_ADD'}">${0-item.cost}</c:if>
									<c:if test="${item.adjustType=='COLLECT_ADD' || item.adjustType=='BUS_BACK_ABATE'}">${item.cost}</c:if>
								</td>
								<td >
									<c:if test="${item.adjustType=='COLLECT_ADD'}">应收款增加</c:if>
									<c:if test="${item.adjustType=='COLLECT_ABATE'}">应收款减少</c:if>
								</td>
								<td >
									<a href="javascript:doAdjustBillShow('${item.id}');">查看</a>
									<a href="javascript:doAdjustBillPrint('${item.id}');">打印</a>
								</td>
							</tr>
							</c:forEach>
							</tbody>
						</table>
					</div>
				</c:if>
    </div>
  </div>
<div class="blank12"></div>	
</div>
</body>
</html>